package com.ddwl.common.constant;

import com.ddwl.common.exception.CommonException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 27670
 * @Date :2020-07-22 14:59.
 */
public interface DistConstant {

    @AllArgsConstructor
    @Getter
    enum SettlementStatus {
        CRE(0, "未结算"),
        PRE(10, "结算中"),
        SUCCEED(20, "结算成功"),
        FILL(30, "结算失败"),
        ;
        private Integer code;
        private String name;
    }

    /**
     * 分销订单状态
     */
    @AllArgsConstructor
    @Getter
    enum DistOrderStatus {
        PAY(0, "已付款"),
        TAKE(1, "已收货"),
        CLOSE(2, "已结算"),
        ;
        private Integer code;
        private String name;
    }

    /**
     * 流水类型
     */
    @AllArgsConstructor
    @Getter
    enum WalletFlowType {
        JS(0, 1, "结算收入"),
        TX(1, 0, "提现支出"),
        TX_FALL(2, 1, "提现失败退回"),
        SHOP(3, 1, "店铺收入"),
        REFUND(4, 0, "退款支出"),
        REFUND_FALL(5, 1, "退款失败收入"),
        SHOP_DIST_REFUND(6, 1, "售后店铺订单佣金退回"),
        SHOP_DIST_REFUND_FALL(7, 0, "售后店铺订单佣金退回"),
        CHARITY_FUND(8, 1, "公益基金收入"),
        DEVICE_CONN_REWARD(9, 1, "儿童定位鞋连续连接奖励"),
        ;
        private Integer type;
        /**
         * 0支出1收入
         */
        private Integer transactionType;
        private String msg;

        public static WalletFlowType getWalletFlowType(Integer type) {
            for (WalletFlowType walletFlowType : values()) {
                if (type.equals(walletFlowType.getType())) {
                    return walletFlowType;
                }
            }
            throw new CommonException("不存在的类型！");
        }

    }

    /**
     * 钱包流水变更类型
     */
    @AllArgsConstructor
    @Getter
    enum WalletFlowChangeType {
        ZC(0, "支出"),
        SR(1, "收入"),
        ;
        private Integer code;
        private String name;
    }

    /**
     * 佣金比例类型
     */
    @AllArgsConstructor
    @Getter
    enum DistrConfigType {
        PRODUCT(0, "销售商品佣金"),
        SHOP(1, "开门店佣金"),
        AGENT(2, "用户发展代理佣金"),
        ;
        private Integer code;
        private String name;
    }

    /**
     * 门店佣金订单
     */
    @AllArgsConstructor
    @Getter
    enum ShopApproveOrder {
        ORDER_ID("154648654564632", "订单id"),
        ITEM_ID("154648654564668", "商品id"),
        SKU_ID("154648654564782", "skuid"),
        SKU_DESC("SHOP_APPROVE", "skuDesc"),
        DIST_RATE("50", "分佣比例"),
        ;
        private String code;
        private String name;
    }
}
